﻿<?php $this->load->view('layout/header'); ?>

<?php
$url = '&ascdesc=' . ($where['ascdesc'] == 'asc' ? 'desc' : 'asc');
$url.='&blockname=' . (isset($where['blockname']) ? $where['blockname'] : '');
$url.='&isclose=' . (isset($where['isclose']) ? $where['isclose'] : '') . '&page=1';

if ($where['ascdesc'] == 'desc') {
    $img[$where['orderkey']] = '<img src="/static/bk/images/down.gif"/>';
} else {
    $img[$where['orderkey']] = '<img src="/static/bk/images/up.gif"/>';
}
if (!isset($where['isrecommend'])) {
    $where['isrecommend'] = -1;
}

if (!isset($where['isclose'])) {
    $where['isclose'] = -1;
}

?>

<form name="form1" method="get" action="<?php echo b_url('block/index') ?>" id="form1">
    <div id="container">
        <!--查询表单开始-->
        <div id="DivQuery">
            <div id="floatBoxBg" style="filter: alpha(opacity=0); opacity: 0;">
            </div>
            <div id="floatBox" class="floatBox">
                <div id="drag" class="title" onmousedown="DragDialog()">
                    <h4>
                        查询</h4>
                    <span>关闭</span></div>
                <div class="content">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_query">
                        <tr class="table_query_row">
                            <td style="width: 15%" align="right">
                                片段标题：
                            </td>
                            <td>
                                <input name="blockname" type="text" id="blockname" value="<?php echo isset($where['blockname']) ? $where['blockname'] : ''; ?>" />
                            </td>
                            <td style="width: 15%" align="right">
                                状态：
                            </td>
                            <td>
                                <input name="blockcontent" type="text" id="blockcontent" value="<?php echo isset($where['blockcontent']) ? $where['blockcontent'] : ''; ?>" />
                            </td>
                        </tr>
                        <tr class="table_query_btn">
                            <td align="right" style="width: 15%">
                            </td>
                            <td>
                                <input type="submit" name="btnQuery" value="查询" id="btnQuery" />
                                <input type="button" value="返回" onclick="javascript:HiddenSearchDialog();" />
                            </td>
                            <td align="right" style="width: 15%">
                            </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <!--查询表单结束-->
        <!--导航开始-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_nav">
            <tr>
                <td>
                    片段内容管理&gt;管理列表
                </td>
            </tr>
        </table>
        <!--导航结束-->
        <!--操作选项开始-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_op">
            <tr>
                <td>
                    操作选项：
                    <a href="<?php echo b_url('block/add'); ?>">添加片段内容</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('block/add?blockid='); ?>" name="blockid" onclick="checkEdit(this);">修改片段内容</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('block/delete?blockid='); ?>" name="blockid" onclick="checkDel(this);">删除片段内容</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('block/openclose?status=0&blockid='); ?>" name="blockid" onclick="checkOperate(this);">批量开放</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('block/openclose?status=1&blockid='); ?>" name="blockid" onclick="checkOperate(this);">批量关闭</a>
                    
                    <a href="javascript:SearchDialog()">查询片段内容</a>


                </td>
            </tr>
        </table>
        <!--操作选项结束-->
        <!--列表开始-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_list" id="TbList">
            <tr class="table_list_title">
                <td style="width: 2%">
                    <input type="checkbox" name="checkbox" value="checkbox" onclick="javascript:checkAll(this, 'blockid')" />
                </td>
                <td style="width: 5%" onclick="javascript:GoTo('?orderkey=blockid<?php echo $url; ?>')" title="点击排序">
                    编号<?php echo isset($img['blockid']) ? $img['blockid'] : '' ?>
                </td>
                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=blockname<?php echo $url; ?>')" title="点击排序">
                    片段标题<?php echo isset($img['blockname']) ? $img['blockname'] : '' ?>
                </td>
                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=clicknum<?php echo $url; ?>')" title="点击排序">
                    访问次数<?php echo isset($img['clicknum']) ? $img['clicknum'] : '' ?>
                </td>
                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=listid<?php echo $url; ?>')" title="点击排序">
                    排序号<?php echo isset($img['listid']) ? $img['listid'] : '' ?>
                </td>
                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=adminid<?php echo $url; ?>')" title="点击排序">
                    创建人<?php echo isset($img['adminid']) ? $img['adminid'] : '' ?>
                </td>
                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=addtime<?php echo $url; ?>')" title="点击排序">
                    创建时间<?php echo isset($img['addtime']) ? $img['addtime'] : '' ?>
                </td>
                <td style="width: 5%" onclick="javascript:GoTo('?orderkey=isclose<?php echo $url; ?>')" title="点击排序">
                    状态<?php echo isset($img['isclose']) ? $img['isclose'] : '' ?>
                </td>
            </tr>
            <?php
            if (!empty($list)) {
                foreach ($list as $k => $v) {
                    ?>
                    <tr class="table_list_row_normal">
                        <td style="width: 2%"><input name="blockid" type="checkbox" value="<?php echo $v['blockid']; ?>" /></td>
                        <td style="width: 5%"><?php echo $v['blockid']; ?></td>
                        <td style="width: 10%"><a href="<?php echo b_url('block/add?blockid=' . $v['blockid']); ?>"><?php echo $v['blockname']; ?></a></td>
                       
                        <td style="width: 10%"><?php echo $v['clicknum']; ?></td>
                        <td style="width: 10%"><?php echo $v['listid'] ?></td>
                        <td style="width: 10%"><?php echo isset($admin[$v['adminid']]['adminname']) ? $admin[$v['adminid']]['adminname'] : ''; ?></td>
                        <td style="width: 10%"><?php echo $v['addtime']; ?></td>
                        <td style="width: 5%"><?php echo $v['isclose'] == 1 ? '关闭' : '开放'; ?></td>
                        
                    </tr>
                    <?php
                }
            }
            ?>
        </table>
        <?php
        if (!empty($list)) {
            echo $pagination->show();
        } else {
            echo '<div id="pager"><p>查询无相关记录!</p></div>';
        }
        ?>	
    </div>
</form>

<script src="/static/bk/js/table.js" type="text/javascript"></script>
<?php $this->load->view('layout/footer'); ?>
